package com.th.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 任务状态
 * @Author tuhang
 * @PackageName nswcy-crowdsource-back
 * @Package com.th.common.enums
 * @Date 2022/10/9 22:40
 * @Version 1.0
 */
@AllArgsConstructor
@Getter
public enum TaskStatus {

    RECRUITMENT_TO_START(1,"招募待启动"),
    RECRUITMENT_IN_PROGRESS(2,"招募进行中"),
    RECRUITMENT_TO_END(3,"招募已结束"),
    TASK_IN_PROGRESS(4,"任务进行中"),
    TASK_TO_END(5,"任务已结束"),
    ;
    private Integer code;
    private String desc;

    /**
     * 检索任务状态
     * @param code
     * @return
     */
    public static  TaskStatus of(Integer code){
        return Arrays.stream(values()).filter(item -> item.code.equals(code)).findFirst().orElse(null);
    }

}
